// 
// $Rev:: 26            $:  Revision of last commit
// $Author:: rvhaverm@g#$:  Author of last commit
// $Date:: 2010-07-26 1#$:  Date of last commit
// 
package agents.configuration;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;


public class HostConfigurationFile implements IHostConfiguration
{
    private Properties _properties;

    /**
     * Load in the property file
     * 
     */
    public HostConfigurationFile(String filename)
    {
	_properties = null;
	try
	{
	    FileInputStream file = new FileInputStream(filename);	    
	    System.getProperties().load(file);	    
	    _properties = System.getProperties();
	}
	catch (FileNotFoundException e)
	{
	    System.out.println("ERROR: file not found: " + e);
	}
	catch (IOException e)
	{
	    System.out.println("ERROR: " + e);
	}

    }

    @Override
    public String getContextName()
    {
	return _properties.getProperty("agentsystem.contextname", "defaultContext");
    }

    @Override
    public String getDBDriver()
    {
	return _properties.getProperty("agentsystem.db.driver", "");
    }

    @Override
    public String getDBName()
    {
	return _properties.getProperty("agentsystem.db.name", "");
    }

    @Override
    public String getDBPass()
    {
	return _properties.getProperty("agentsystem.db.password", "");
    }

    @Override
    public String getDBUser()
    {
	return _properties.getProperty("agentsystem.db.user", "");
    }

    @Override
    public String getMainOffice()
    {
	return _properties.getProperty("agentsystem.hostbillboard", "");
    }

    @Override
    public String getRuntimePass()
    {
	return _properties.getProperty("agentsystem.runtime.password", "");
    }

    @Override
    public String getRuntimeUser()
    {
	return _properties.getProperty("agentsystem.runtime.user", "");
    }

    @Override
    public String getUI()
    {
	return _properties.getProperty("agentsystem.uitype", "console");
    }

    @Override
    public String getAgentSources()
    {
	return _properties.getProperty("agentsystem.runtime.agentsources", "");
    }

}
